package com.bdqn;

import com.bdqn.entity.News;
import com.bdqn.factory.AbstractFactory;
import com.bdqn.factory.RedisDaoFactory;
import com.bdqn.service.impl.NewsServiceImpl;

/**
 * Test02
 *
 * @author LILIBO
 * @since 2021-10-08
 */
public class Test02 {

    public static void main(String[] args) {
        // 在调用的地方生产一个NewsDao的实例对象
        AbstractFactory abstractFactory = new RedisDaoFactory();
        NewsServiceImpl newsService = new NewsServiceImpl();
        // 使用NewsServiceImpl类中提供的方法将所需要依赖的对象传入
        newsService.setDao(abstractFactory.getInstance());
        newsService.save(new News());
    }
}
